package com.jd.finance.core.controller.api;


import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jd.finance.core.service.BankService;
import com.jd.finance.core.service.ProductService;
import com.jd.finance.result.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 银行表 前端控制器
 * </p>
 *
 * @author LiQingBo
 * @since 2022-05-17
 */
@Slf4j
@Api(tags = "银行中心")
@RestController
@RequestMapping("/api/core/bankCenter")
public class BankController {

    @Resource
    private ProductService productService;

    @Resource
    private BankService bankService;

    @ApiOperation("根据地区查询所有可贷款银行")
    @GetMapping("/getLoadBank")
    public BaseResult getLoadBank(String City) {
        if(StringUtils.isBlank(City)){
            log.error("查询所有可贷款银行,信息为空！");
            return BaseResult.error().message("该地区暂无可贷款的银行");
        }
        return bankService.getLoadBank(City);
    }

}

